function showToast(title) {
  wx.showToast({
    title: title,
    icon: 'none'
  })
}
// 请求函数
export function request(method, data, url) {
  return new Promise((resolve, reject) => {
    wx.request({
      url: url,
      method: method,
      data: data,
      header: {
        'Authorization': 'Bearer ' + wx.getStorageSync('token')
      },
      timeout: 10000,
      success(res) {
        if (res.data.code === '0000') {
          resolve(res.data);
        } else {
          showToast(res.data.msg)
        }
      },
      fail() {
        showToast('请求出错')
      }
    })
  })
}